package cn.humaohua.study.yanmo_design_pattern.ch15.v4;

public abstract class Component {
    /**
     * 记录每个组件的路径
     */
    private String componentPath = "";

    public String getComponentPath() {
        return componentPath;
    }

    public void setComponentPath(String componentPath) {
        this.componentPath = componentPath;
    }

    /**
     * 获取组件的名字
     * @return
     */
    public abstract String getName();


    /* --------------下面是原有定义--------------- */

    public abstract void printStruct(String preStr);

    public void addChild(Component child) {
        throw new UnsupportedOperationException("对象不支持这个功能");
    }

    public void removeChild(Component child) {
        throw new UnsupportedOperationException("对象不支持这个功能");
    }

    public void getChildren(int index) {
        throw new UnsupportedOperationException("对象不支持这个功能");
    }
}
